package com.eascs.web.o2o.web.dao;

import com.eascs.app.dao.JdbcSession;
import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.SqlPageQuery;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import javax.inject.Inject;

@Repository
public class QuartzDao {
	@Inject
	JdbcSession jdbcSession;
	
	
	public boolean updateEntity(Object entity) {
		return jdbcSession.updateById(entity)>0?true:false;
	}

	public boolean insert(Object entity) {
		return jdbcSession.insert(entity)>0?true:false;
	}
	
	public <T> boolean delete(Class<T> requiredType,String id) {
		return jdbcSession.deleteById(requiredType, id)>0?true:false;
	}
	
	
    public <T> Object findEntity(String sql, Class<T> requiredType, Object... params){
    	return jdbcSession.findEntity(sql, requiredType, params);
    }
    
    public <T> PageResult<T> findDataWithPage(SqlPageQuery<T> sqlPageQuery) {
		return this.jdbcSession.findDataWithPage(sqlPageQuery);
	}
    

}
